// port i/o

#include <system.h>

// port out
void outportb( short port, char dat )
{
	__asm__ __volatile__ ( "outb %1,%0" : : "dN" (port), "a" (dat) );
}
void outportw( short port, short dat )
{
	__asm__ __volatile__ ( "outw %1,%0" : : "dN" (port), "a" (dat) );
}
void outportl( short port, int dat )
{
	__asm__ __volatile__ ( "outl %1,%0" : : "dN" (port), "a" (dat) );
}

// port in
char inportb( short port )
{
	char dat;
	__asm__ __volatile__ ( "inb %1, %0" : "=a" (dat) : "dM" (port) );
	return dat;
}
short inportw( short port )
{
	short dat;
	__asm__ __volatile__ ( "inw %1, %0" : "=a" (dat) : "dM" (port) );
	return dat;
}
int inportl( short port )
{
	int dat;
	__asm__ __volatile__ ( "inl %1, %0" : "=a" (dat) : "dM" (port) );
	return dat;
}
